close all
xx1= 1;% period 1 is steady state
xx2 = 300;
ccr = 'b';
lwd = 2;
smc =20;

load ./ramsey_1s2c_perfect2/output/ramsey_1s2c_perfect2_results.mat

ncountries=2;
nsectors =1;
n = ncountries;
ns = nsectors;

vname={'T1','T2','taux','x1','x2','w1','w2','P2'};

nv = length(vname);
for i=1:nv
    mm=strcmpi(vname(i),M_.endo_names);
    ttt=find(mm==1);
    if (isempty(ttt)==0)
        ivname(i) = ttt; % declaration order
    else
        ivname(i) =0;
        
        fprintf(1,'cannot find variable %s\n',char(vname(i)));
    end
    eval(['i',char(vname(i)),'=',num2str(i),';'])
end

for i=1:nv
    yvar(i,:) = oo_.endo_simul(ivname(i),:);
end

    
 Tperiod = 1:length(yvar);
% figure(1)
% hold on
% yy = yvar(isa1,:);
% plot(Tperiod,yy,'Color',ccr,'LineWidth',lwd)
% set(gca,'FontSize',smc)
% text(Tperiod(5),yy(5),'Ramsey','FontSize',smc,'Color',ccr)
% xlim([xx1,xx2])
% title('\alpha_1')

idiff = 0;

figure(2)
hold on
if (idiff==0)
yy = yvar(iT1,:);
else
    yy = yvar(iT1,:)-yvar(iT1,1);
end

plot(Tperiod,yy,'Color',ccr,'LineWidth',lwd)
set(gca,'FontSize',smc)
text(Tperiod(5),yy(5),'Ramsey','FontSize',smc,'Color',ccr)
xlim([xx1,xx2])
title('T1')

figure(3)
if (idiff==0)
    yy = yvar(iT2,:);
else
    yy = yvar(iT2,:)-yvar(iT2,1);
end
plot(Tperiod,yy,'Color',ccr,'LineWidth',lwd)
set(gca,'FontSize',smc)
text(Tperiod(5),yy(5),'Ramsey','FontSize',smc,'Color',ccr)
xlim([xx1,xx2])
title('T2')

figure(4)
if (idiff==0)
    yy = yvar(itaux,:);
else
yy = yvar(itaux,:)/yvar(itaux,1)-1;
end

plot(Tperiod,yy,'Color',ccr,'LineWidth',lwd)
set(gca,'FontSize',smc)
text(Tperiod(5),yy(5),'Ramsey','FontSize',smc,'Color',ccr)
xlim([xx1,xx2])
title('\tau_x')

figure(5)
if (idiff==0)
    yy = yvar(ix1,:);
else

yy = yvar(ix1,:)-yvar(ix1,1);
end

plot(Tperiod,yy,'Color',ccr,'LineWidth',lwd)
set(gca,'FontSize',smc)
text(Tperiod(5),yy(5),'Ramsey','FontSize',smc,'Color',ccr)
xlim([xx1,xx2])
title('x1')

figure(6)
if (idiff==0)
    yy = yvar(ix2,:);
else
yy = yvar(ix2,:)-yvar(ix2,1);
end
plot(Tperiod,yy,'Color',ccr,'LineWidth',lwd)
set(gca,'FontSize',smc)
text(Tperiod(5),yy(5),'Ramsey','FontSize',smc,'Color',ccr)
xlim([xx1,xx2])
title('x2')

figure(7)
if (idiff==0)
    yy = yvar(iw1,:);
else
yy = yvar(iw1,:)-yvar(iw1,1);
end
plot(Tperiod,yy,'Color',ccr,'LineWidth',lwd)
set(gca,'FontSize',smc)
text(Tperiod(5),yy(5),'Ramsey','FontSize',smc,'Color',ccr)
xlim([xx1,xx2])
title('w1')

figure(8)
if (idiff==0)
    yy = yvar(iw2,:);
else
yy = yvar(iw2,:)-yvar(iw2,1);
end
plot(Tperiod,yy,'Color',ccr,'LineWidth',lwd)
set(gca,'FontSize',smc)
text(Tperiod(5),yy(5),'Ramsey','FontSize',smc,'Color',ccr)
xlim([xx1,xx2])
title('w2')

figure(9)
hold on
if (idiff==0)
    yy = yvar(iP2,:);
else
yy = yvar(iP2,:)-yvar(iP2,1);
end
plot(Tperiod,yy,'Color',ccr,'LineWidth',lwd)
set(gca,'FontSize',smc)
text(Tperiod(5),yy(5),'Ramsey','FontSize',smc,'Color',ccr)
xlim([xx1,xx2])
title('P2')



